package com.spsoft.vatoutinv.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * 优惠政策标识枚举类
 *
 * @author wangy
 */

@Getter
public enum YhzcbsEnum {

    _01("01", "简易征收"),
    _02("02", "稀土产品"),
    _03("03", "免税"),
    _04("04", "不征税"),
    _05("05", "先征后退"),
    _06("06", "100%先征后退"),
    _07("07", "50%先征后退"),
    _08("08", "按3%简易征收"),
    _09("09", "按5%简易征收"),
    _10("10", "按5%简易征收减按1.5%计征"),
    _11("11", "即征即退30%"),
    _12("12", "即征即退50%"),
    _13("13", "即征即退70%"),
    _14("14", "即征即退100%"),
    _15("15", "超税负3%即征即退"),
    _16("16", "超税负8%即征即退"),
    _17("17", "超税负12%即征即退"),
    _18("18", "超税负16%即征即退");

    public final String key;
    public final String value;

    YhzcbsEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public static boolean isInclude(String key) {
        boolean include = false;
        for (YhzcbsEnum e : YhzcbsEnum.values()) {
            if (e.getKey().equals(key)) {
                include = true;
                break;
            }
        }
        return include;
    }

    public static String getValueByKey(String key) {
        for (YhzcbsEnum e : YhzcbsEnum.values()) {
            if (e.getKey().equals(key)) {
                return e.getValue();
            }
        }
        return StringUtils.EMPTY;
    }

    public static String getKeyByValue(String value) {
        for (YhzcbsEnum e : YhzcbsEnum.values()) {
            if (e.getValue().equals(value)) {
                return e.getKey();
            }
        }
        return StringUtils.EMPTY;
    }

    public static YhzcbsEnum getYhzcbsEnumByKey(String key) {
        for (YhzcbsEnum e : YhzcbsEnum.values()) {
            if (e.getKey().equals(key)) {
                return e;
            }
        }
        return null;
    }
}
